<meta charset="utf-8">
<title>number check</title>
<script>
function validate(){
	var result = false;
	
	var tel1 = document.phoneForm.tel1;
	var tel2 = document.phoneForm.tel2;
	var msg = document.getElementById('msg');
	
	if(isNull(tel1,tel2))
		msg.innerHTML = "<font color='red'>전화번호를 입력하세요.</font>";		
	else {
		if(isNaN(tel1.value)||isNaN(tel2.value))
			msg.innerHTML = "<font color='red'>전화번호는 숫자만 입력하세요.</font>";		
		else result = true;	
	}
	
	return result;
		
}

function isNull(tel1,tel2){		
	var result = false;
	if(tel1.value.length==0||tel2.value.length==0) result=true;	
	return result;
}
</script>
<form name="phoneForm" action="next.html" onSubmit="return validate()">
	<input type="text" name="tel1" size="3"/> -
	<input type="text" name="tel2" size="4"/>
	<input type="submit"/>	
</form>
<p id="msg"></p>